#ifndef __LIST_H__
#define __LIST_H__
/************************************************************************************************/
typedef struct entry_s
	{
	void *data;
	struct entry_s *next;
	} entry_t;
/************************************************************************************************/
class list_c //all indexes are zero-based (first entry = entry 0, second = 1, third = 2, etc)
	{
	public:
		entry_t *firstentry;
		entry_t *lastentry;
		int count;
	public:
		list_c();
		~list_c();
		void add(void *data);
		void ins(void *data,int n);
		void del(int n);
		void del_savedata(int n);
		void clear();
		void *get(int n);
		int num();
#ifdef TEST
		entry_t *getfirstentry(){return(firstentry);}
		entry_t *getlastentry(){return(lastentry);}
		int validatenum()
			{
			int i;
			entry_t *e = firstentry;

			for(i=0;e;i++)
				e = e->next;
			if(i != count)
				return(1); //error
			return(0); //ok
			}
#endif
	};
/************************************************************************************************/
#endif
